package com.oneraku.service.controller;

import com.alibaba.fastjson.JSONObject;
import com.oneraku.service.domain.*;
import com.oneraku.service.service.IAdminService;
import com.oneraku.service.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: hui.ren@huberbuy.com
 * @Date: 2020/4/6 13:05
 */
@RestController
@RequestMapping("/console")
public class ConsoleController {
    @Autowired
    private IAdminService adminService;
    /**
     * 管理员登录
     * @param userAdmin
     * @return
     */
    @PostMapping("/login")
    public R login(@RequestBody UserAdmin userAdmin){
        return adminService.login(userAdmin);
    }

    /**
     * 获取管理员信息
     * @return
     */
    @GetMapping("/userinfo")
    public R userinfo(){
        return adminService.userinfo();
    }

    /**
     * 管理员登出
     * @return
     */
    @GetMapping("/logout")
    public R logout(){
        return adminService.logout();
    }

    /**
     * 人员列表
     * @return
     */
    @PostMapping("/mangerList")
    public R mangerList(@RequestBody UserAdmin userAdmin){
        return adminService.mangerList(userAdmin);
    }

    /**
     * 人员列表
     * @return
     */
    @GetMapping("/mangerSelect")
    public R mangerSelect(){
        return adminService.mangerSelect();
    }

    /**
     * 人员新增
     * @return
     */
    @PostMapping("/mangerAdd")
    public R mangerAdd(@RequestBody UserAdmin userAdmin){
        return adminService.mangerAdd(userAdmin);
    }

    /**
     * 人员删除
     * @return
     */
    @PostMapping("/mangerDel")
    public R mangerDel(@RequestBody UserAdmin userAdmin){
        return adminService.mangerDel(userAdmin);
    }

    /**
     * 人员编辑
     * @return
     */
    @PostMapping("/mangerEdit")
    public R mangerEdit(@RequestBody UserAdmin userAdmin){
        return adminService.mangerEdit(userAdmin);
    }
    /**
     * 后台管理修改自己信息
     * @return
     */
    @PostMapping("/self/edit")
    public R selfEdit(@RequestBody UserAdmin userAdmin){
        return adminService.selfEdit(userAdmin);
    }

    /**
     * 自己修改密码
     * @return
     */
    @PostMapping("/resetPassword")
    public R resetPassword(@RequestBody UserAdmin userAdmin){
        return adminService.resetPassword(userAdmin);
    }

    /**
     * 超管初始化密码
     * @return
     */
    @PostMapping("/initPassword")
    public R initPassword(@RequestBody UserAdmin userAdmin){
        return adminService.initPassword(userAdmin);
    }

    /**
     * 人员列表
     * @return
     */
    @PostMapping("/merchantList")
    public R merchantList(@RequestBody Merchant merchant){
        return adminService.merchantList(merchant);
    }


    /**
     * 商家分类
     * @return
     */
    @GetMapping("/merchantCategoryList")
    public R merchantCategoryList(){
        return adminService.merchantCategoryList();
    }
    /**
     * 人员列表
     * @return
     */
    @PostMapping("/merchantCategory")
    public R merchantCategory(@RequestBody MerchantCategory merchant){
        return adminService.merchantCategory(merchant);
    }

    /**
     * 人员新增
     * @return
     */
    @PostMapping("/merchantAdd")
    public R merchantAdd(@RequestBody Merchant merchant){
        return adminService.merchantAdd(merchant);
    }

    /**
     * 人员删除
     * @return
     */
    @PostMapping("/merchantDel")
    public R merchantDel(@RequestBody Merchant merchant){
        return adminService.merchantDel(merchant);
    }

    /**
     * 人员编辑
     * @return
     */
    @PostMapping("/merchantEdit")
    public R merchantEdit(@RequestBody Merchant merchant){
        return adminService.merchantEdit(merchant);
    }

    /**
     * 工单列表
     * @return
     */
    @PostMapping("/workOrderList")
    public R workOrderList(@RequestBody WorkOrder workOrder){
        return adminService.workOrderList(workOrder);
    }

    /**
     * 分配工单
     * @return
     */
    @PostMapping("/workOrderAssign")
    public R workOrderAssign(@RequestBody WorkOrder workOrder){
        return adminService.workOrderAssign(workOrder);
    }

    /**
     * 查看工单评论
     * @return
     */
    @PostMapping("/workOrderComments")
    public R workOrderComments(@RequestBody WorkOrderComment comment){
        return adminService.workOrderComments(comment);
    }
    /**
     * 添加工单评论
     * @return
     */
    @PostMapping("/addWorkOrderComments")
    public R addWorkOrderComments(@RequestBody WorkOrderComment comment){
        return adminService.addWorkOrderComments(comment);
    }
    /**
     * 代拍代购列表
     * @return
     */
    @PostMapping("/agentBuyList")
    public R agentList(@RequestBody AgentSeckill agentSeckill){
        return adminService.agentBuyList(agentSeckill);
    }
    /**
     * 代拍代购处理
     * @return
     */
    @PostMapping("/agentBuyDeal")
    public R agentBuyDeal(@RequestBody AgentSeckill agentSeckill){
        return adminService.agentBuyDeal(agentSeckill);
    }

    /**
     * 代拍代购集货转运处理
     * @return
     */
    @GetMapping("/agentBuySteps/{id}")
    public R agentBuySteps(@PathVariable String id){
        return adminService.agentBuySteps(id);
    }
    /**
     * 代拍代购处理
     * @return
     */
    @PostMapping("/operators")
    public R operators(@RequestBody Operator operator){
        return adminService.operators(operator);
    }
}
